home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / SpellCompositor / SpellRegister.java < prev    next >
Encoding:
Java Source  |  2001-06-23  |  2.2 KB  |  100 lines

  1. /*
  2. This file and its intellectual contents are considered property of the creator and are to be treated as such with respect to use in other applications.  Any use of this software for any purpose whatsoever must have explicit permission from the author of the file.  This code is part of an ongoing development process for future possible products, and so is considered private property.
  3. Do not use without permission.  Author: Scott C. Ziegler <Aslan@Narnia.net>
  4. */
  5.  
  6. package Arcana;
  7.  
  8. import java.awt.*;
  9. import java.io.*;
  10. import java.util.*;
  11. import java.awt.event.*;
  12. import java.awt.Color;
  13.  
  14. // SpellRegister
  15. //
  16. //        designed to hold the organizational aspect of a spell for
  17. //        sorting and display.    
  18.     
  19. public class SpellRegister implements Sorter.Comparable, Serializable {
  20.     
  21.     String         Name;
  22.     String         School;
  23.     int         Level;
  24.     int         Components;
  25.     
  26.     // *** need reference to related SpellRecord
  27.     SpellRecord    SourceSpell;
  28.     
  29.     // Constructors
  30.     
  31.     public SpellRegister() {} 
  32.     // to be followed shortly by a call to setRegister()
  33.     
  34.     public SpellRegister(SpellRecord spell) {
  35.         Name = new String(spell.getName());
  36.         School = new String(spell.getSchool());
  37.         Level = spell.getLevel();
  38.         Components = spell.getComponents();
  39.         SourceSpell = spell;
  40.         }
  41.     
  42.     // Selectors
  43.     
  44.     public String getName() {
  45.         return Name;
  46.         }
  47.         
  48.     public String getSchool() {
  49.         return School;
  50.         }
  51.         
  52.     public int getLevel() {
  53.         return Level;
  54.         }
  55.         
  56.     public int getComponents() {
  57.         return Components;
  58.         }
  59.         
  60.     public SpellRecord getSourceSpell() {
  61.         return SourceSpell;
  62.         }
  63.         
  64.     // Mutators
  65.     
  66.     public void setLevel(int lvl) {
  67.         Level = lvl;
  68.         }
  69.         
  70.     public void setName(String name) {
  71.         Name = name;
  72.         }
  73.         
  74.     public void setSchool(String school) {
  75.         School = school;
  76.         }
  77.         
  78.     public void setComponents(int comps) {    
  79.         Components = comps;
  80.         }
  81.     
  82.     public void setSourceSpell(SpellRecord spRec) {
  83.         SourceSpell = spRec;
  84.         }
  85.     
  86.     public void setRegister(SpellRecord spell) {
  87.         Name = spell.getName();
  88.         School = spell.getSchool();
  89.         Level = spell.getLevel();
  90.         Components = spell.getComponents();
  91.         SourceSpell = spell;
  92.         }
  93.         
  94.     // Interface - Sorter.Comparable
  95.         
  96.     public int compareTo(Object other) {
  97.         return Name.compareTo(((SpellRegister)other).getName());
  98.         }
  99.         
  100.     }